package convert

import (
	"gitee.com/smallow/srpc/infrastructure/model"
	"gitee.com/smallow/srpc/infrastructure/proto/pb"
)

func PbUser2ModeUser(user *pb.User) *model.User {
	return &model.User{
		Name:         user.Name,
		Phone:        user.Phone,
		Account:      user.Account,
		Password:     user.Password,
		CompanyID:    int(user.CompanyID),
		DepartmentID: int(user.DepartmentID),
		AppID:        user.AppID,
		Memo:         user.Memo,
	}
}

func ModelUser2PbUser(user *model.User) *pb.User {
	return &pb.User{
		Name:         user.Name,
		Phone:        user.Phone,
		Account:      user.Account,
		Password:     user.Password,
		CompanyID:    int32(user.CompanyID),
		DepartmentID: int32(user.DepartmentID),
		AppID:        user.AppID,
		Memo:         user.Memo,
	}
}
